package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbCheckStandard;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbCheckStandardMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbCheckStandard> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbCheckStandardResult")
    TbCheckStandard selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbCheckStandardResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="sign", property="sign", jdbcType=JdbcType.VARCHAR),
        @Result(column="code", property="code", jdbcType=JdbcType.INTEGER),
        @Result(column="code_name", property="codeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="score", property="score", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
        @Result(column="create_id", property="createId", jdbcType=JdbcType.BIGINT),
        @Result(column="descs", property="descs", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="modify_id", property="modifyId", jdbcType=JdbcType.BIGINT),
        @Result(column="modify_time", property="modifyTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbCheckStandard> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbCheckStandardDynamicSqlSupport.tbCheckStandard);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCheckStandardDynamicSqlSupport.tbCheckStandard);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .where(TbCheckStandardDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbCheckStandard record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .map(TbCheckStandardDynamicSqlSupport.sign).toProperty("sign")
                .map(TbCheckStandardDynamicSqlSupport.code).toProperty("code")
                .map(TbCheckStandardDynamicSqlSupport.codeName).toProperty("codeName")
                .map(TbCheckStandardDynamicSqlSupport.type).toProperty("type")
                .map(TbCheckStandardDynamicSqlSupport.score).toProperty("score")
                .map(TbCheckStandardDynamicSqlSupport.parentId).toProperty("parentId")
                .map(TbCheckStandardDynamicSqlSupport.createId).toProperty("createId")
                .map(TbCheckStandardDynamicSqlSupport.descs).toProperty("descs")
                .map(TbCheckStandardDynamicSqlSupport.remark).toProperty("remark")
                .map(TbCheckStandardDynamicSqlSupport.inputTime).toProperty("inputTime")
                .map(TbCheckStandardDynamicSqlSupport.modifyId).toProperty("modifyId")
                .map(TbCheckStandardDynamicSqlSupport.modifyTime).toProperty("modifyTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbCheckStandard record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .map(TbCheckStandardDynamicSqlSupport.sign).toPropertyWhenPresent("sign", record::getSign)
                .map(TbCheckStandardDynamicSqlSupport.code).toPropertyWhenPresent("code", record::getCode)
                .map(TbCheckStandardDynamicSqlSupport.codeName).toPropertyWhenPresent("codeName", record::getCodeName)
                .map(TbCheckStandardDynamicSqlSupport.type).toPropertyWhenPresent("type", record::getType)
                .map(TbCheckStandardDynamicSqlSupport.score).toPropertyWhenPresent("score", record::getScore)
                .map(TbCheckStandardDynamicSqlSupport.parentId).toPropertyWhenPresent("parentId", record::getParentId)
                .map(TbCheckStandardDynamicSqlSupport.createId).toPropertyWhenPresent("createId", record::getCreateId)
                .map(TbCheckStandardDynamicSqlSupport.descs).toPropertyWhenPresent("descs", record::getDescs)
                .map(TbCheckStandardDynamicSqlSupport.remark).toPropertyWhenPresent("remark", record::getRemark)
                .map(TbCheckStandardDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .map(TbCheckStandardDynamicSqlSupport.modifyId).toPropertyWhenPresent("modifyId", record::getModifyId)
                .map(TbCheckStandardDynamicSqlSupport.modifyTime).toPropertyWhenPresent("modifyTime", record::getModifyTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckStandard>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbCheckStandardDynamicSqlSupport.id, TbCheckStandardDynamicSqlSupport.sign, TbCheckStandardDynamicSqlSupport.code, TbCheckStandardDynamicSqlSupport.codeName, TbCheckStandardDynamicSqlSupport.type, TbCheckStandardDynamicSqlSupport.score, TbCheckStandardDynamicSqlSupport.parentId, TbCheckStandardDynamicSqlSupport.createId, TbCheckStandardDynamicSqlSupport.descs, TbCheckStandardDynamicSqlSupport.remark, TbCheckStandardDynamicSqlSupport.inputTime, TbCheckStandardDynamicSqlSupport.modifyId, TbCheckStandardDynamicSqlSupport.modifyTime)
                .from(TbCheckStandardDynamicSqlSupport.tbCheckStandard);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckStandard>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbCheckStandardDynamicSqlSupport.id, TbCheckStandardDynamicSqlSupport.sign, TbCheckStandardDynamicSqlSupport.code, TbCheckStandardDynamicSqlSupport.codeName, TbCheckStandardDynamicSqlSupport.type, TbCheckStandardDynamicSqlSupport.score, TbCheckStandardDynamicSqlSupport.parentId, TbCheckStandardDynamicSqlSupport.createId, TbCheckStandardDynamicSqlSupport.descs, TbCheckStandardDynamicSqlSupport.remark, TbCheckStandardDynamicSqlSupport.inputTime, TbCheckStandardDynamicSqlSupport.modifyId, TbCheckStandardDynamicSqlSupport.modifyTime)
                .from(TbCheckStandardDynamicSqlSupport.tbCheckStandard);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbCheckStandard selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbCheckStandardDynamicSqlSupport.id, TbCheckStandardDynamicSqlSupport.sign, TbCheckStandardDynamicSqlSupport.code, TbCheckStandardDynamicSqlSupport.codeName, TbCheckStandardDynamicSqlSupport.type, TbCheckStandardDynamicSqlSupport.score, TbCheckStandardDynamicSqlSupport.parentId, TbCheckStandardDynamicSqlSupport.createId, TbCheckStandardDynamicSqlSupport.descs, TbCheckStandardDynamicSqlSupport.remark, TbCheckStandardDynamicSqlSupport.inputTime, TbCheckStandardDynamicSqlSupport.modifyId, TbCheckStandardDynamicSqlSupport.modifyTime)
                .from(TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .where(TbCheckStandardDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbCheckStandard record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .set(TbCheckStandardDynamicSqlSupport.sign).equalTo(record::getSign)
                .set(TbCheckStandardDynamicSqlSupport.code).equalTo(record::getCode)
                .set(TbCheckStandardDynamicSqlSupport.codeName).equalTo(record::getCodeName)
                .set(TbCheckStandardDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbCheckStandardDynamicSqlSupport.score).equalTo(record::getScore)
                .set(TbCheckStandardDynamicSqlSupport.parentId).equalTo(record::getParentId)
                .set(TbCheckStandardDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbCheckStandardDynamicSqlSupport.descs).equalTo(record::getDescs)
                .set(TbCheckStandardDynamicSqlSupport.remark).equalTo(record::getRemark)
                .set(TbCheckStandardDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbCheckStandardDynamicSqlSupport.modifyId).equalTo(record::getModifyId)
                .set(TbCheckStandardDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbCheckStandard record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .set(TbCheckStandardDynamicSqlSupport.sign).equalToWhenPresent(record::getSign)
                .set(TbCheckStandardDynamicSqlSupport.code).equalToWhenPresent(record::getCode)
                .set(TbCheckStandardDynamicSqlSupport.codeName).equalToWhenPresent(record::getCodeName)
                .set(TbCheckStandardDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbCheckStandardDynamicSqlSupport.score).equalToWhenPresent(record::getScore)
                .set(TbCheckStandardDynamicSqlSupport.parentId).equalToWhenPresent(record::getParentId)
                .set(TbCheckStandardDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbCheckStandardDynamicSqlSupport.descs).equalToWhenPresent(record::getDescs)
                .set(TbCheckStandardDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark)
                .set(TbCheckStandardDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbCheckStandardDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId)
                .set(TbCheckStandardDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbCheckStandard record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .set(TbCheckStandardDynamicSqlSupport.sign).equalTo(record::getSign)
                .set(TbCheckStandardDynamicSqlSupport.code).equalTo(record::getCode)
                .set(TbCheckStandardDynamicSqlSupport.codeName).equalTo(record::getCodeName)
                .set(TbCheckStandardDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbCheckStandardDynamicSqlSupport.score).equalTo(record::getScore)
                .set(TbCheckStandardDynamicSqlSupport.parentId).equalTo(record::getParentId)
                .set(TbCheckStandardDynamicSqlSupport.createId).equalTo(record::getCreateId)
                .set(TbCheckStandardDynamicSqlSupport.descs).equalTo(record::getDescs)
                .set(TbCheckStandardDynamicSqlSupport.remark).equalTo(record::getRemark)
                .set(TbCheckStandardDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbCheckStandardDynamicSqlSupport.modifyId).equalTo(record::getModifyId)
                .set(TbCheckStandardDynamicSqlSupport.modifyTime).equalTo(record::getModifyTime)
                .where(TbCheckStandardDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbCheckStandard record) {
        return UpdateDSL.updateWithMapper(this::update, TbCheckStandardDynamicSqlSupport.tbCheckStandard)
                .set(TbCheckStandardDynamicSqlSupport.sign).equalToWhenPresent(record::getSign)
                .set(TbCheckStandardDynamicSqlSupport.code).equalToWhenPresent(record::getCode)
                .set(TbCheckStandardDynamicSqlSupport.codeName).equalToWhenPresent(record::getCodeName)
                .set(TbCheckStandardDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbCheckStandardDynamicSqlSupport.score).equalToWhenPresent(record::getScore)
                .set(TbCheckStandardDynamicSqlSupport.parentId).equalToWhenPresent(record::getParentId)
                .set(TbCheckStandardDynamicSqlSupport.createId).equalToWhenPresent(record::getCreateId)
                .set(TbCheckStandardDynamicSqlSupport.descs).equalToWhenPresent(record::getDescs)
                .set(TbCheckStandardDynamicSqlSupport.remark).equalToWhenPresent(record::getRemark)
                .set(TbCheckStandardDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbCheckStandardDynamicSqlSupport.modifyId).equalToWhenPresent(record::getModifyId)
                .set(TbCheckStandardDynamicSqlSupport.modifyTime).equalToWhenPresent(record::getModifyTime)
                .where(TbCheckStandardDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}